<template>
  <div>
    <el-radio-group v-model="isCollapse" style="margin-bottom: 20px;">
      <el-radio-button :label="false">展开</el-radio-button>
      <el-radio-button :label="true">收起</el-radio-button>
    </el-radio-group>
    <el-menu
      default-active="1-4-1"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      :collapse="isCollapse"
      router
    >
      <el-submenu index>
        <template slot="title">
          <i class="el-icon-location"></i>
          <span slot="title">用户列表</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/">用户列表</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index>
        <template slot="title">
          <i class="el-icon-menu"></i>
          <span slot="title">面试宝典</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/msbd">面试宝典</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isCollapse: true
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    }
  }
};
</script>

<style scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  min-height: 400px;
}
</style>